module.exports = (app) => {
  const { Schema, createModel, getModelName, pre, formatDate } = app.jax.mongoose
  const modelName = getModelName(__filename)

  const schema = new Schema({
    role: Number, /// 角色
    mobile: String, // 手机号
    name: String, // 姓名
    nickname: String, // 昵称
    password: String, // 密码
    avatar: String, // 头像
    storeId: Schema.Types.ObjectId, // 服务站ID
    loginTime: { type: Date, get: (date) => formatDate(date) }, // 登录时间
    activityCount: { type: Number, default: 0 }, // 参加活动次数
  })

  const Model = createModel(modelName, schema)

  return Model
}
